﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Documents;

namespace Common.Tool
{
    public class EnumToName : IValueConverter
    {
        /// <summary>
        /// 枚举转名称
        /// </summary>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Enum)
            {
                return Enum.GetName(value.GetType(), value);
            }
            else
            {
                foreach (var item in value as List<Enum>)
                {
                    Enum.GetName(item.GetType(), value);
                }
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
